# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/29 下午3:02
 @Author  : tgy
 
"""
import re

from attribute import Attribute

class Person(Attribute):
    def __init__(self, name: str, job=None, pay: int = None):
        ...
        self.name = name
        self.job = job
        self.pay = pay

    def last_name(self):

        if not self.name:
            return

        return re.split(r'\.', self.name)[-1]

    def get_raise(self, percent):
        """

        :param percent:
        :return:
        """
        if not any((self.job, self.pay)):
            return 0
        return int(self.pay * (1 + percent))


class Manager(Person):
    ...

    def __init__(self, name: str, job, pay):
        ...
        # Person.__init__(self, name, job=job, pay=pay)
        super(Manager, self).__init__(name,job,pay)

    def get_raise(self, percent,other:int = 0):
        ...
        return Person.get_raise(self,percent=percent) + other


if __name__ == '__main__':
    ...
    person = Person('tony.jar')
    print(person.last_name())
    print(person.get_raise(0.3))
    manager = Manager('zhangsan', 'web', 1023)
    # print(manager.last_name())
    # print(manager.get_raise(0.4, 90))
    print(person.__dict__.keys())
    print(person)
